package org.jeecg.modules.service;

import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.entity.CuUserDetails;
import org.jeecg.modules.entity.CuWalletaMnagement;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.entity.CuWalletaTransaction;
import org.jeecg.modules.mapper.CuWalletaMnagementMapper;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Description: 钱包管理
 * @Author: jeecg-boot
 * @Date: 2024-08-05
 * @Version: V1.0
 */
public interface ICuWalletaMnagementService extends IService<CuWalletaMnagement> {

    /**
     * 根据用户id查询交易明细
     * 如果查到就返回 没有就创建
     */
    CuWalletaMnagement queryByUserId(CuUserDetails userDetails);

    /**
     * 修改钱包金额并记录明显
     * @param userId 用户
     * @param amount 余额
     * @param type 类型
     * @param start 状态
     * @param description 描述
     * @param otherId 其他
     * @return
     */
    boolean updateWalletAmount(String userId, BigDecimal amount, String type, String start, String description, String otherId);

    /**
     * 支付分成计算
     */
    boolean payReward(CuUserDetails details, BigDecimal amount);

}
